<?php

namespace App\Repository;


use App\User;
class UserRepos 
{
    /** @var User 注入的User model */
    protected $user;

    /**
     * UserRepository constructor.
     * @param User $user
     */
    public function __construct(User $user)
    {
        $this->user = $user;
    }

    /**
     * 回傳大於?年紀的資料
     * @param integer $age
     * @return Collection
     */
    public function getAgeLargerThan($age)
    {
    	$data = $this->user->where('id', '>', $age)->orderBy('id')->get()->toArray();
        $data = json_decode(json_encode($data), true);
        return $data;
    }
}
